// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// This is the grouping of adaptive expression functions by type as seen on:
// https://docs.microsoft.com/en-us/azure/bot-service/adaptive-expressions/adaptive-expressions-prebuilt-functions?view=azure-bot-service-4.0

export const builtInFunctionsGrouping = [
  {
    key: 'collection',
    name: 'Collection',
    children: [
      'contains',
      'count',
      'first',
      'flatten',
      'foreach',
      'indicesAndValues',
      'intersection',
      'join',
      'last',
      'select',
      'skip',
      'sortBy',
      'sortByDescending',
      'subArray',
      'take',
      'union',
      'unique',
      'where',
    ],
  },
  {
    key: 'conversion',
    name: 'Conversion',
    children: [
      'base64',
      'base64ToBinary',
      'base64ToString',
      'binary',
      'bool',
      'createArray',
      'dataUri',
      'dataUriToBinary',
      'dataUriToString',
      'float',
      'formatNumber',
      'int',
      'json',
      'string',
      'uriComponent',
      'uriComponentToString',
      'xml',
    ],
  },
  {
    key: 'dateAndTime',
    name: 'Date and time',
    children: [
      'addDays',
      'addHours',
      'addMinutes',
      'addSeconds',
      'addToTime',
      'convertFromUTC',
      'convertToUTC',
      'date',
      'dateReadBack',
      'dateTimeDiff',
      'dayOfMonth',
      'dayOfWeek',
      'dayOfYear',
      'formatDateTime',
      'formatEpoch',
      'formatTicks',
      'getFutureTime',
      'getNextViableDate',
      'getNextViableTime',
      'getPastTime',
      'getPreviousViableDate',
      'getPreviousViableTime',
      'getTimeOfDay',
      'month',
      'startOfDay',
      'startOfHour',
      'startOfMonth',
      'subtractFromTime',
      'ticks',
      'ticksToDays',
      'ticksToHours',
      'ticksToMinutes',
      'utcNow',
      'year',
    ],
  },
  {
    key: 'logicalComparison',
    name: 'Logical comparison',
    children: [
      'and',
      'empty',
      'equals',
      'exists',
      'greater',
      'greaterOrEquals',
      'if',
      'less',
      'lessOrEquals',
      'not',
      'or',
    ],
  },
  {
    key: 'math',
    name: 'Math',
    children: [
      'add',
      'average',
      'ceiling',
      'div',
      'exp',
      'floor',
      'max',
      'min',
      'mod',
      'mul',
      'rand',
      'range',
      'round',
      'sub',
      'sum',
    ],
  },
  {
    key: 'objectManipulationAndConstruction',
    name: 'Object manipulation and construction',
    children: [
      'addProperty',
      'coalesce',
      'getProperty',
      'jPath',
      'removeProperty',
      'setPathToValue',
      'setProperty',
      'xPath',
    ],
  },
  {
    key: 'regularExpression',
    name: 'Regular expression',
    children: ['isMatch'],
  },
  {
    key: 'string',
    name: 'String',
    children: [
      'addOrdinal',
      'concat',
      'countWord',
      'endsWith',
      'indexOf',
      'lastIndexOf',
      'length',
      'newGuid',
      'replace',
      'replaceIgnoreCase',
      'sentenceCase',
      'split',
      'startsWith',
      'substring',
      'titleCase',
      'toLower',
      'toUpper',
      'trim',
    ],
  },
  {
    key: 'timex',
    name: 'Timex',
    children: ['isDate', 'isDateRange', 'isDefinite', 'isDuration', 'isPresent', 'isTime', 'isTimeRange'],
  },
  {
    key: 'typeChecking',
    name: 'Type checking',
    children: ['EOL', 'isArray', 'isBoolean', 'isDateTime', 'isFloat', 'isInteger', 'isObject', 'isString'],
  },
  {
    key: 'uriParsing',
    name: 'URI parsing',
    children: ['uriHost', 'uriPath', 'uriPathAndQuery', 'uriPort', 'uriQuery', 'uriScheme'],
  },
];
